this.view ={extend: 'iframe', doctype: "transitional"}

this.handler = function(){
	
	var user = request.attr("user"),
		anchorId = request.params.id,
		anchor = storage.anchors.getById(anchorId)
		editAnchorForm = forms.editAnchor(anchor);
	
	if(user && (user.username == anchor.owner)){
	
		this.get = function(){
			
			var errorMessage = editAnchorForm.errorMessage;
			
			$("body").html("<p>Edit in-text anchor '" + anchor.str + "'.</p>");
			errorMessage && $("body").append('<p>' + errorMessage + '</p>');
			$("body").append(editAnchorForm.html());
			
		}
		
		this.post = function(){
			var action = actions.editAnchorProcess(editAnchorForm, anchorId, anchor);
			if(action === "remove"){
				response.write('<script>window.parent.AutoHref.removeAnchor(' + anchorId + ', true);</script>');
			} else if(action === 'edit') {
				response.write('<script>window.parent.AutoHref.removeAnchor(' + anchorId + ');window.parent.AutoHref.makeAnchors('+[anchor].toSource()+');</script>');
			
			} else {
				this.get();
			}
		}
	
	} else {
	 	
		this.get = this.post = function(){
			$("body").append("forbidden");
		}
	
	}
}